<?php

declare(strict_types=1);

namespace owns\auth;

/**
 * 用户
 */
class MemberAuth
{
    private static $obj;

    public readonly object $auth;

    private function __construct()
    {
        $this->auth = request()->auth;
    }
    public function __clone()
    {
    }
    /**
     * 实例化
     */
    public static function instance(): MemberAuth
    {
        if (self::$obj instanceof MemberAuth) {
            return self::$obj;
        }
        self::$obj = new self();
        return self::$obj;
    }
    /**
     * 登录用户信息
     */
    public function auth(): object
    {
        return $this->auth;
    }
    /**
     * 登录用户id
     */
    public function uid(): int
    {
        return $this->auth->uid;
    }
}
